<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 判断一个数是否是质数
        function isprime(n) {
            for (var i = 2; i < n; i++) {
                if (n % i == 0) {
                    return (false);
                }
                if (i == n-1) {
                    return (true);
                }
            }
        }
        // console.log(isprime(3));
        // console.log(isprime(9));

        // 判断一个偶数是否是两个质数之和
        function gedebahe(n) {
            for (var i = 1; i <= n/2; i++) {
                var k = n - i;
                if (isprime(i) && isprime(k)) {
                    console.log(n + "可以拆分成两个质数" + i + "和" + k);
                }
            }
        }
        var n = parseInt(prompt("请输入一个偶数"));
        gedebahe(n);
    </script>
</head>
<body>
    
</body>
</html>